package com.itheima;

/**
 * 2025/3/24 20:00
 * 求水仙花数
 */
public class ForPractice3 {
    public static void main(String[] args) {

        //定义一个变量记录水仙花数的个数
        int count = 0;
        for (int i = 100; i <= 999; i++) {
            int ge = i % 10;
            int shi = i / 10 % 10;//123 / 10==12%10 = 2
            int bai = i / 100;//567 / 100 = 5
            if(ge * ge * ge + shi * shi * shi + bai * bai * bai == i){
                System.out.println(i);
                //记录
                count++;
            }
        }
        //输出总共有多少水仙花数？
        System.out.println("总共有" + count + "个水仙花数");

    }
}
